import os
import re


def getFileListByFilter(dir, filter=".*.md"):
    """
    :param dir: 要遍历的文件夹
    :param filter: 正则过滤器
    :return:
    """
    Filelist = []
    for home, dirs, files in os.walk(dir):
        for filename in files:
            if re.search(filter, filename):
                Filelist.append(os.path.join(home, filename))
    return Filelist


if __name__ == "__main__":
    Filelist = getFileListByFilter("../", '.*.md')
    for file in Filelist:
        print(file)
    # C:\Anaconda3\envs\WindowsAuto\python.exe D:/GZUniversity/Project/JDRead2PDF/runtime/myfile.py
    # ./11.1 Spark实验：SparkWordCount.md
    # ./11.2 Spark实验：RDD综合实验.md
    # ./11.3 Spark实验：Spark综例.md
    # ./11.4 Spark实验：Spark SQL.md
    # ./11.5 Spark实验：Spark Streaming.md
    # ./11.6 Spark实验：GraphX.md
    # ./实验模板.md
